Keywords: NEWTON PDA DEV DEVELOPMENT SOURCE CODE NTK
TYPE: Distribute Freely
Following many calls for the posting of source code, I am making this early version of my little scientific calculator available. These are a few random jottings to explain why I did some of the extraordinary things which I have done, and hopefully to make up for the complete lack of comments.
When I first started this, I was tempted to use one of the keyboard objects as a prototype. I was deterred partly by the difficulty in trying to get them to work, but largely because they prevented me from using the easy visual design of the interface which the NTK excels in. It has since proved a good decision, as it has been much easier to tweak and tune the layout as things have progressed. Maybe in future NTK releases, this will be different.
The way in which the calculator works centres on the result view, which contains two numeric slots (containing the last and last but one numbers as floats), the text displayed in the view, and various other slots and methods to make it all work. When you click on a number key, it simply appends that digit to the displayed string, etc. When you click on a function key, then an appropriate script is called to execute that function.
My ploy to make this easy to program is to use the compile() function. Thus, the basic evaluation engine builds a string to compile(), compile()s it, and then displays the result.
This file has been checked with the latest version of McAfee Scan and/or DisInfectant 3.5 and is known to be virus-free at the time of uploading.
This file can be found in the PDA Forum's Software Libraries (Keyword PDA).